<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>首页</title>
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta http-equiv="Cache-Control" content="no-transform">
		<meta name="format-detection" content="telephone=no">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<link rel="stylesheet" href="style/css/basic.css" />
		<link rel="stylesheet" href="style/css/recommend.css" />
		<script type="text/javascript" src="style/plugin/mui/js/mui.min.js"></script>
		<script type="text/javascript" src="style/js/jquery-1.8.3.min.js"></script>
		<script type="text/javascript" src="style/mockjs/dist/mock.js"></script>
		<script type="text/javascript" src="style/js/vue.min.js"></script>
		<script type="text/javascript" src="style/js/vue-resource.js"></script>
		<script type="text/javascript" src="style/js/basic.js"></script>
		<style>
			.recommend{
				position: relative;
			}
			.sou{
				position:absolute;
				top:10px;
				right:10px;
				display:inline-block;
				height:30px;
				text-align:center;
				padding:0 7px;
				border:1px solid dodgerblue;
				line-height:30px;
				margin-top:4px;
				border-radius:4px;
				color:dodgerblue
			}
		</style>
	</head>
	<body>
		<div id="recommand">
			<div id="header">
				<h1>推荐</h1>
				<!--<span class="righttxt">提交</span>-->
			</div>
			<!--content-->
			<div class="body">
				
				<div class="recommend">
					<div>
						<label>选择业务员</label>
						<input type="text" placeholder="请输入名字和手机号" v-model="sele"><span class="sou" @tap="serch">搜索</span>
					</div>
					<div>
						<label>业务员编号</label>
						<input type="text" placeholder="会员编号" v-model="memnum">
					</div>
					<div>
						<label>联系人</label>
						<input type="text" placeholder="联系人" v-model="cname">
					</div>
					<div>
						<label>电话</label>
						<input type="tel" placeholder="手机号码" v-model="cphone">
					</div>
					<div>
						<label>用酒时间</label>
						<input type="date" placeholder="用酒时间" v-model="utime">
					</div>
					<div>
						<label>用酒类型</label>
						<input type="text" placeholder="用酒类型" v-model="utype">
					</div>
					<div class="button" @tap="sub"><a href="javascript:void(0);">提交</a></div>
				</div>
				
			</div>
		</div>
		<!--footer-->
		<div class="footer" id="footer">
			<ul class="clearfix">
				<li>
					<a href='recommend_index.html' ;><i class="icon_home"></i><span>首页</span></a>
				</li>
				<li>
					<a href="recommend.html"><i class="icon_recommend"></i><span class="active_color">推荐</span></a>
				</li>
				<li>
					<a href='recommend_mall.html' ;><i class="icon_integral"></i><span>积分</span></a>
				</li>
				<li>
					<a href='recommend_my.html' ;><i class="icon_my"></i><span>我的</span></a>
				</li>
			</ul>
		</div>
		<script>
			new Vue({
				el:"#recommand",
				data:{
					cname:"",
					cphone:"",
					utime:"",
					utype:"",
					ticket:"",
				    sign:"",
				    memnum:"",
				    sele:""
				},
				methods:{
					sub:function(){
						if(this.memnum==""||this.cname==""||this.cphone==""||this.utime==""||this.utype==""){
							mui.toast("请填写完整信息")
						}else{
							this.$http.post(domain+"/recommend_form/create?t="+this.ticket+"&sign="+this.sign,{
								mem_no:this.memnum,
								name:this.cname,
								phone:this.cphone,
								use_time:this.utime,
								use_scene:this.utype
							},{emulateJSON:true}).then(
					            function (res) {
					                // 处理成功的结果  
					                if(res.body.code==1){
					                  mui.toast(res.body.msg)
					                  this.cname="";
					                  this.cphone="";
					                  this.utime="";
					                  this.utype="";
					                  this.memnum=""; 
					                }else{
					                	mui.toast(res.body.msg)
					                }
					            },function (res) {
					            // 处理失败的结果
					            console.log(res) 
					            }
					        )
						}
					},
					serch:function(){
						this.$http.post(domain+"/member/getOtherInfo?t="+this.ticket+"&sign="+this.sign,{
							keyword:this.sele
						},{emulateJSON:true}).then(
				            function (res) {
				                // 处理成功的结果  
				                if(res.body.code==1){
				                    this.memnum=res.body.data.mem_no
				                }else{
				                	mui.toast(res.body.msg)
				                }
				            },function (res) {
				            // 处理失败的结果
				            console.log(res) 
				            }
				        )
					}
				},
				created:function(){
					this.ticket=localStorage.getItem("tick")
                    this.sign=localStorage.getItem("sig")
				}
			})
		</script>
	</body>
</html>
